|
OpenStack Havana - Use Virtual Storage(LVM)
2013/10/23 |
|
It's possible to use Virtual Storage provided by Cinder for Virtual Machine Instance.
This example shows to set to use LVM for Virtual Storage.
|
|
| [1] | Create a new Volume group for Cinder. |
|
[root@dlp ~(keystone)]# pvcreate /dev/sdb1 Physical volume "/dev/sdb1" successfully created [root@dlp ~(keystone)]# vgcreate -s 32M vg_volume01 /dev/sdb1 Volume group "vg_volume01" successfully created |
| [2] | Configure Cinder |
|
[root@dlp ~(keystone)]#
vi /etc/cinder/cinder.conf # line 1241: uncomment and specify volume group volume_group= vg_volume01
/etc/rc.d/init.d/openstack-cinder-volume restart Stopping openstack-cinder-volume: [ OK ] Starting openstack-cinder-volume: [ OK ] |
| [3] | For example, create a volume named "disk01", 10GB. |
|
[root@dlp ~(keystone)]# cinder create --display_name disk01 10
+---------------------+--------------------------------------+
| Property | Value |
+---------------------+--------------------------------------+
| attachments | [] |
| availability_zone | nova |
| bootable | false |
| created_at | 2013-10-23T16:40:31.855619 |
| display_description | None |
| display_name | disk01 |
| id | 20a8ef96-4530-4f2d-b89f-0086993c38bb |
| metadata | {} |
| size | 10 |
| snapshot_id | None |
| source_volid | None |
| status | creating |
| volume_type | None |
+---------------------+--------------------------------------+
[root@dlp ~(keystone)]# cinder list +--------------------------------------+-----------+--------------+------+-------------+----------+-------------+ | ID | Status | Display Name | Size | Volume Type | Bootable | Attached to | +--------------------------------------+-----------+--------------+------+-------------+----------+-------------+ | 20a8ef96-4530-4f2d-b89f-0086993c38bb | available | disk01 | 10 | None | false | | +--------------------------------------+-----------+--------------+------+-------------+----------+-------------+ |
| [4] | Attach the volume just created to Instance. The following example just attached to the Instance as "/dev/vdb". |
|
[root@dlp ~(keystone)]# nova list +--------------------------------------+-----------+---------+------------+-------------+--------------------+ | ID | Name | Status | Task State | Power State | Networks | +--------------------------------------+-----------+---------+------------+-------------+--------------------+ | 081bba5e-0a88-4ae5-9757-645f682d172b | CentOS_64 | SHUTOFF | None | Shutdown | network01=10.1.0.2 | +--------------------------------------+-----------+---------+------------+-------------+--------------------+[root@dlp ~(keystone)]# nova volume-attach CentOS_64 20a8ef96-4530-4f2d-b89f-0086993c38bb auto +----------+--------------------------------------+ | Property | Value | +----------+--------------------------------------+ | device | /dev/vdb | | serverId | 081bba5e-0a88-4ae5-9757-645f682d172b | | id | 20a8ef96-4530-4f2d-b89f-0086993c38bb | | volumeId | 20a8ef96-4530-4f2d-b89f-0086993c38bb | +----------+--------------------------------------+ |
| [5] | By the way, it's possible to operate create or attach, dettach volumes on the DashBoard. |
|